package com.cloudkinto.controller.covershows;


import com.cloudkinto.common.annotations.UserSessionRequired;
import io.swagger.annotations.ApiImplicitParams;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.cloudkinto.service.covershows.CustomerCaseService;

import com.cloudkinto.common.web.PageResult;
import com.cloudkinto.common.web.SingleResult;

import javax.servlet.http.HttpServletRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;

import java.util.HashMap;
import java.util.Map;

import com.cloudkinto.base.BaseController;

/**
 * <p>
 *  前端控制器
 * </p>
 * @author zhangyy
 * @since 2020-10-12
 */
@RestController
@Api(tags = "客户案例模块")
@RequestMapping("/api/customerCase")
public class CustomerCaseController extends BaseController {
    private final Logger logger = LoggerFactory.getLogger(CustomerCaseController.class);

    @Autowired
    private CustomerCaseService service;


    @GetMapping("")
    @ApiOperation(value = "根据id查看详情", notes = "根据id查看详情")
    public SingleResult detail() {
        return SingleResult.success("查询成功",service.detail());
    }


    @GetMapping("/listPage")
    @ApiOperation(value = "查询（分页）", notes = "查询（分页）")
    @ApiImplicitParams({@ApiImplicitParam(name = "current", value = "当前页"),
            @ApiImplicitParam(name = "pageSize", value = "页面大小")})
    public PageResult listPage(HttpServletRequest request){

        Map<String, String> map = new HashMap<>();
        String current = request.getParameter("current");
        String size = request.getParameter("pageSize");
        map.put("current", current);
        map.put("pageSize", size);
        return service.getListPage(map);
    }

}

